<!-- 稽查报告调阅 -->
<template>

    <el-main>
      <el-button @click="test"></el-button>
        <h2>稽查报告调阅</h2>
            <div class="Form">
            <el-form :inline="true" :model="reportid" class="demo-form-inline">
                <el-form-item label="检索调查报告">
                    <el-input v-model= "reportid" placeholder="记录ID">
                      <el-button slot="append" type="primary" @click= "search">查询</el-button>
                    </el-input>
                </el-form-item>

                <el-form-item>

                </el-form-item>
            </el-form>
        </div>
        <div class="Table">
            <el-table
                :data= "tableData"
                stripe
                style="width: 100%">
              <el-table-column
                label="查看报告"
                prop="report"
                type="expand">
                <template slot-scope="scope">
                  <div>
                    {{scope.row.report}}
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                label="车牌号"
                prop="cId">
              </el-table-column>
              <el-table-column
                label="记录id"
                prop="id">
              </el-table-column>
              <el-table-column
                label="稽查员ID"
                prop="iID">
              </el-table-column>
              <el-table-column
                label="车主"
                prop="oId">
              </el-table-column>
            </el-table>
        </div>
    </el-main>

</template>

<script>
import axios from 'axios'
  export default {
    data() {
        return {
          reportid:'',
          tableData: [],
          formInline: {
            user: '',
            id: ''
          }
        }
    },
    methods: {
      test(){
        this.tableData=[
          {"cId":"京A11111","id":"109","iID":"1","oId":"owner_1","report":"3333"}
        ]
      },
      async search(){
        console.log(this.reportid.toString())
        let mydata='id='+this.reportid
        axios.post('http://8.140.14.231:8080/chaincode/report-detail/get-one', mydata).then((res)=>{
          console.log(res)
          this.tableData=[res.data]
          console.log(this.tableData)
        })
      },
    }
  }
</script>
